#include <header.h>

pthread_rwlock_t lock = PTHREAD_RWLOCK_INITIALIZER;

void *run(void *p){
	pthread_rwlock_rdlock(&lock);
	printf("child\n");
	sleep(1);
	pthread_rwlock_unlock(&lock);
	return NULL;
}


int main(int argc, char* argv[]){

	pthread_t p;
	pthread_create(&p, NULL, run, NULL);

	pthread_rwlock_wrlock(&lock);
	printf("main\n");
	sleep(15);
	pthread_rwlock_unlock(&lock);

	pthread_join(p, NULL);
	return 0;
}